﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Logoned.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="Chowpoo.Util" %>
<%@ Import Namespace="CourseSystem.Common.Helpers" %>
<%@ Import Namespace="CourseSystem.Core.Enum" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    课程评价
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
        <% Html.RenderPartial("TopUc"); %>
        <% Html.RenderPartial("NavUc", 7); %>
        <% Html.RenderPartial("CommentNavUc", ViewData["type"].CheckInt(0)); %>
    </table>
    <table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td height="200" align="center" valign="top" class="contentBackImg">
                <table width="950" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td height="28" align="left" background="<%= ResolveUrl("~/Content/images/5_01_1.gif") %>">
                            <table width="378" height="28" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td width="22">
                                    </td>
                                    <td width="356">
                                        <div align="left">
                                            <span class="style10">
                                                <%= UserHelper.LoginUser.IsExpert ? "专家" : "学生" %>评价</span>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" valign="top" background="<%= ResolveUrl("~/Content/images/5_02_1.gif") %>">
                            <table width="944" height="25" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td width="22" bgcolor="#CCCCCC">
                                        &nbsp;
                                    </td>
                                    <td width="922" bgcolor="#CCCCCC">
                                        <div align="left">
                                            <span class="style28Black">
                                                <%= UserHelper.LoginUser.IsExpert ? "专家" : "学生" %>评语</span></div>
                                    </td>
                                </tr>
                            </table>
                            <table width="944" height="10" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td>
                                        &nbsp;
                                    </td>
                                </tr>
                            </table>
                            <% if (UserHelper.LoginUser.UserType != UserTypeEnum.Guess)
                               {
                                   using (Html.BeginForm("CommentEdit", "Comment", new { reviewType = 0 }))
                                   { %>
                            <table width="800" border="0" cellpadding="0" cellspacing="0">
                                <tr align="left">
                                    <td>
                                        <input type="radio" name="type" checked="checked" value="1" id="type0" />
                                        <label for="type0">
                                            对课程评价</label>
                                        <input type="radio" name="type" value="0" id="type1" />
                                        <label for="type1">
                                            对教师评价</label>
                                        <select style="display: none" name="teacherId" id="teacherId">
                                        </select>
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                            </table>
                            <table width="800" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td>
                                        &nbsp;
                                        <textarea name="commentContent" id="commentContent" style="width: 800px; height: 50px"></textarea>
                                    </td>
                                </tr>
                            </table>
                            <table width="800" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td height="25">
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td height="25" align="left">
                                        <div id="rank" class="selectStar" align="left">
                                            <span class="red">*</span><span class="zi">评级打分 </span><span class="dpCont"></span>
                                            <em><a href="#" class="star_item">1</a> <a href="#" class="star_item">2</a> <a href="#"
                                                class="star_item">3</a> <a href="#" class="star_item">4</a> <a href="#" class="star_item">
                                                    5</a> </em>
                                        </div>
                                        <input type="hidden" id="rankHid" name="rankHid" value="3" />
                                    </td>
                                </tr>
                            </table>
                            <table width="800" height="25" border="0" cellpadding="0" cellspacing="0">
                                <tr class="style29">
                                    <td width="49">
                                        <div align="left">
                                            评语人：</div>
                                    </td>
                                    <td width="62">
                                        <div align="left">
                                            <%= UserHelper.LoginUser.UserName %></div>
                                    </td>
                                    <td width="36">
                                        <div align="left">
                                            时间：</div>
                                    </td>
                                    <td width="653">
                                        <div align="left">
                                            <%= DateTime.Now.ToString("yyyy-MM-dd") %></div>
                                    </td>
                                </tr>
                            </table>
                            <table width="800" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td height="25" align="center">
                                        <input type="submit" value="提交评语" />
                                    </td>
                                </tr>
                            </table>
                            <% }
                               }
                            %>
                            <p>
                                课程评价预览</p>
                            <div id="listDiv">
                                <% Html.RenderAction("CommentListUc"); %>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td height="3" background="<%=ResolveUrl("~/Content/images/5_04_1.gif")%>">
                        </td>
                    </tr>
                </table>
                <table width="1000" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td height="10">
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <div id="editDiv" title="查看评价">
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    <script src="<%=ResolveUrl("~/Scripts/starLevel.js") %>" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('#rank').starLevel();
            $("input[name='type']").change(function () {
                var th = $(this);
                if (th.val() == "0") {
                    selectLoad("teacherId", "Ajax/GetTeacher/1", null, function () {
                        if ($('#teacherId option').length < 1) {
                            alert("该课程未添加教师信息!");
                            $("input[type='radio'][value='1']").attr("checked", true);
                            return;
                        }
                        $("#teacherId").show();
                        return;
                    });
                } else {
                    $("#teacherId").hide();
                }

            });

            $("#editDiv").dialog({
                autoOpen: false,
                height: 450,
                width: 550,
                modal: true,
                close: function () {
                }
            });
        });
        var editClickA = function (id) {
            $("#editDiv").html("loading...");
            $("#editDiv").load(appRoot + 'Comment/DetailsUc/' + id);
            $("#editDiv").dialog("open");
        };
    </script>
</asp:Content>
